<!DOCTYPE html>
<html lang="en">

<%- include('common/head') %>

<body>
  <%- include('common/navbar') %>

  <div class="container">
    <ol class="breadcrumb">
      <li><a href="/">博客首页</a></li>
      <li class="active">内容列表</li>
    </ol>
    <h2>内容列表</h2>
    <div class="userInfoList">
      <table class="table table-striped">
        <tr>
          <th>ID</th>
          <th>分类名称</th>
          <th>标题</th>
          <th>作者</th>
          <th>添加时间</th>
          <th>阅读量</th>
          <th>操作</th>
        </tr>
        <% contents.forEach(function(content) { %>
        <tr style="font-size: 16px">
          <td class="categoryId" width="30%"><%= content.id %></td>
          <td width="10%"><%= content.category.name %></td>
          <td width="10%"><%= content.title %></td>
          <td width="10%"><%= content.author %></td>
          <td width="20%">
          <%= content.time.getFullYear() + '.' %>
          <% if ((content.time.getMonth() + 1) < 10) { %>
            <%= '0' + content.time.getMonth() + '.' %>
          <% } else { %>
            <%= content.time.getMonth() + '.' %>
          <% } %>
          <%= content.time.getDate() %>
          </td>
          <td width="10%"><%= content.views %></td>
          <td width="10%">
            <a href="/admin/content/edit?id=<%= content.id %>">修改</a>
            <a href="/admin/content/delete?id=<%= content.id %>">删除</a>
          </td>
        </tr>
        <% }) %>
      </table>
    </div>
    <%- include('common/page') %>
  </div>

  <script src="/js/jquery3.3.1.js"></script>
  <script src="/js/bootstrap.js"></script>
</body>
</html>
